import 'package:flutter_cate/core/model/category_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cate/core/extension/int_extension.dart';
import 'package:flutter_cate/ui/pages/meal/meal.dart';


class AMHomeCategoryItem extends StatelessWidget {

  final AMCategoryModel _category;
  AMHomeCategoryItem(this._category);

  @override
  Widget build(BuildContext context) {

    final bgColor = _category.cColor;

    return GestureDetector(
      child: Container(
        child:Text(
          _category.title,
          style: Theme.of(context).textTheme.headline2.copyWith(fontWeight: FontWeight.bold)),
        alignment: Alignment.center,
        decoration: BoxDecoration(
          color: bgColor,
          borderRadius: BorderRadius.circular(12.px),
          gradient: LinearGradient(
            colors: [
              bgColor.withOpacity(.5),
              bgColor
            ]
          )
        ),
      ),
      onTap: (){
        Navigator.of(context).pushNamed(AMMealScreen.routeName, arguments: _category);
      },
    );
  }
}
